<?php

require_once '../config.php';
require_once '../functions.php';
// books_get_current_user();


books_get_current_user();

$list = book_fetch_all("select * from list");


?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>Users &laquo; Admin</title>
  <link rel="stylesheet" href="/static/assets/vendors/bootstrap/css/bootstrap.css">
  <link rel="stylesheet" href="/static/assets/vendors/font-awesome/css/font-awesome.css">
  <link rel="stylesheet" href="/static/assets/vendors/nprogress/nprogress.css">
  <link rel="stylesheet" href="/static/assets/css/admin.css">
  <script src="/static/assets/vendors/nprogress/nprogress.js"></script>
</head>
<body>
  <script>NProgress.start()</script>

  <div class="main">
  <?php include 'inc/navbar_admin.php'; ?>

    <div class="container-fluid">
      <div class="page-title" style="display:flex;justify-content: space-between; align-items: center;">
        <h1>所有书籍</h1>
        <a href="/admin/book-add.php" class="btn btn-info btn-xs">添加</a>
      </div>
     
      <table class="table table-striped table-bordered table-hover">
        <thead>
          <tr>
            <th>图片</th>
            <th>作者</th>
            <th>评论</th>
            <th>提交于</th>
            <th style="width:700px">简介</th>
            <th>ISBN</th>
            <th class="text-center" width="100">操作</th>
          </tr>
        </thead>
        <tbody>
            <?php foreach($list as $item):?>
                <tr>
            <td class="text-center"><img class="avatar" src="<?php echo $item['picture']?>"></td>
            <td><?php echo $item['title']?></td>
            <td><?php echo $item['number']?></td>
            <td><?php echo $item['created']?></td>
            <td><?php echo $item['synopsis']?></td>
            <td><?php echo $item['list_isbn']?></td>
            <td class="text-center">
              <!-- <a href="/admin/book-add.php?id=<?php echo $item['id']?>" class="btn btn-info btn-xs">添加</a> -->
              <a href="/admin/book-delete.php?id=<?php echo $item['id']?>" class="btn btn-danger btn-xs">删除</a>
            </td>
          </tr>
                <?php endforeach?>
        </tbody>
      </table>
    </div>
  </div>

  <?php $current_page = 'book'; ?>
  <?php include 'inc/sidebar.php'; ?>

  <script src="/static/assets/vendors/jquery/jquery.js"></script>
  <script src="/static/assets/vendors/bootstrap/js/bootstrap.js"></script>
  <script>NProgress.done()</script>
</body>
</html>
